#ifndef TIMEDVOXELS_HPP
#define TIMEDVOXELS_HPP

namespace Dynamic
{


struct TimedVoxels {
	double* array;
	int timeSliceCount;
	double dt;
public:
	TimedVoxels(int timeSliceCount, double dt);
	TimedVoxels(const TimedVoxels& v);

	~TimedVoxels();

	static int VoxelIndex(int i, int j);

	double& at(int i, int j, unsigned int timeSliceId);
	const double& at(int i, int j, unsigned int timeSliceId) const;

	double& at(int voxelIndex, unsigned int timeSliceId);

	const double& at(int voxelIndex, unsigned int timeSliceId) const;

	void operator=(const TimedVoxels& m);

	void Zero();
	void start(double hits);

	void InitVoxels(double activity = 1);

	double getAccumulatedValue(int voxelIndex) const;
	double getMeasurementInterval() const;

	double getAccumulatedValue(int i, int j) const;

	double getValueAtTime(int voxelIndex, double t) const;

	double MaxAccumulated() const;
	double Max(int border = 0) const;
	double Sum() const;

	double L2ErrorSum(const TimedVoxels& xRef, double corr = 1.0) const;
	double L2ErrorTime(const TimedVoxels& xRef, double corr = 1.0) const;

	void PrintImage(const char* ofname, double maxvoxel, bool bar = false);
	void PrintInTxt(const char* ofname, double maxvoxel);
	void PrintPlot(const char* ofname, double maxvoxel);
	void PrintPlotForDensityOverTime(const char* ofname, int minX, int minY, int maxX, int maxY, double dt);
};
}

#endif // TIMEDVOXELS_HPP
